﻿/*-------------------------页签式的无忧小精灵批量处理脚本added by linsendu 20110824-start-------------------------------------*/
//EHR.openDivMask();
var tab_selectedIndex = 0; //当前简历索引
var tab_countResumes = 0; //总简历数
var tmptab_selectedIndex = 0; //记录上一个访问的页签位置
var tab_groupIndex = 1; //当前组索引
var tab_currentPage = "folder";
function tab_ShowUser(index) {//显示用户信息
    AjaxShowLoadMask();
    AjaxLoadShow();
    //tab_InitTabList(index);
    tmptab_selectedIndex = tab_selectedIndex;
    tab_selectedIndex = index;
    var ctlHidIds = $("#" + hidNameId);
    //如果当前简历==点击的简历 不做处理
    if (ctlHidIds.val() != $("#tab_lnkUserId" + index).attr("value")) {
        ctlHidIds.val($("#tab_lnkUserId" + index).attr("value"));
        $("#hidUserID").val($("#tab_lnkUserId" + index).attr("value2"));   //UserID也同时改变
        var hidVisitedUserIds = $('#hidVisitedUserIds').val() + "," + $("#tab_lnkUserId" + index).attr("value");
        $('#hidVisitedUserIds').val(hidVisitedUserIds);
        CloseTimeout();
        __doPostBack(hidNameId, '');

    }
    else {

        hideLoadDiv();
    }
    return false;
}
function tab_InitTabList(index) {//初始化页签列表
    tab_preNextResume(); //切换页签显示
}
function tab_BuildUserList(curPage, isDelete) {//建立页签列表
    tab_currentPage = curPage;
    var divUserList = $("#tab_divUserList");
    divUserList.html("");
    var ctlHidIds = $("#" + hidNameAllIds); //get all UserIDs or SeqIds
    if (!ctlHidIds || !ctlHidIds.val()) return;

    //用户名
    var arrUserNames = null;
    var arrUserIDs = null;
    var arrHasPics = null;
    var arrSexs = null;
    if ($("#hidAllUserNames").val() != null) {
        arrUserNames = $("#hidAllUserNames").val().split("→");
        arrUserIDs = $("#hidAllUserIds").val().split(',');
    } else {
        arrUserIDs = ctlHidIds.val().split(',');
    }
    //职位id
    var arrJobIds = null;
    if ($("#hidAllJobIds").val() != null) {
        arrJobIds = $("#hidAllJobIds").val().split(',');
    }
    //单笔简历不做批量处理
    var arrSeqIDs = ctlHidIds.val().split(',');
    var arrSexs = "";
    if ($("#hidUserSex") && $("#hidUserSex").val() != "") {
        arrSexs = $("#hidUserSex").val().split(',');
    }
    tab_countResumes = arrSeqIDs.length;
    var divUserListAll = gid("tab_divUserListAll");
    if (arrSeqIDs.length > 1) {
        if (divUserListAll != null) {//divUserListAll display 
            divUserListAll.style.display = "block";
        }
        for (j = 0; j < arrSeqIDs.length; j++) {
            if (arrSeqIDs[j] != "") {
                var arrJobid = 0;
                if (arrJobIds != null && arrJobIds[j]) arrJobid = arrJobIds[j];
                if (arrUserNames != null) {
                    if (arrSexs != "") {
                        tab_AddUser(j, arrSeqIDs[j], arrUserNames[j], arrUserIDs[j], arrSexs[j], arrJobid);
                    } else {
                        tab_AddUser(j, arrSeqIDs[j], arrUserNames[j], arrUserIDs[j], 0, arrJobid);
                    }
                }
                else {
                    if (arrSexs != "") {
                        tab_AddUser(j, arrSeqIDs[j], "", arrUserIDs[j], arrSexs[j], arrJobid);
                    } else {
                        tab_AddUser(j, arrSeqIDs[j], "", arrUserIDs[j], 0, arrJobid);
                    }
                }
                if (arrSeqIDs[j] == $("#hidSeqID").val()) {
                    tab_selectedIndex = j;
                    if (tab_selectedIndex == 0) tab_groupIndex = 1;
                }
            }
        }

        tab_InitChkUsers();
        var pImg = gid('tab_chkImg' + tab_selectedIndex);
        if (pImg == null || pImg == undefined) {//当当前节点被删除后，如果后面有节点则后面节点向前移入，否则当前索引节点向前移动一位
            tab_selectedIndex = (tab_selectedIndex > 0 ? (tab_selectedIndex - 1) : 0);
            pImg = gid('tab_chkImg' + tab_selectedIndex);
        }
        var newP = gid(tab_tblNameUserList + tab_selectedIndex);
        if (newP) newP.className = "rview_tab1_bgon";
        if (pImg) pImg.src = IMGPATH + "image/candidate/ca1.gif";
        tab_InitTabList(tab_selectedIndex);
        gid('tab_lblTabtotal').innerHTML = "共" + arrSeqIDs.length + "条"; //modify by chaowei.wang 20160120 
        InitMenuPostion(); //需要重新定位小精灵菜单层
    }
    else {
        $("#" + hidNameCheckedIds).val(""); //clear checked Ids
        if (divUserListAll != null) {//divUserListAll none display 
            divUserListAll.style.display = "none";
        }
    }
    RV_InitButton();
}
function tab_DeleteUser(userid, index) {//删除用户
    if (typeof (varIsResumeView) == 'undefined')  //ResumeViewResumeView的加载提示和Folder页面的不一样
    {
        //showMaskDiv();
        //LoadShow();
        AjaxShowLoadMask();
        AjaxLoadShow();
    }
    else {
        AjaxShowLoadMask();
        AjaxLoadShow();
    }
    $("#" + tab_tblNameUserList + index).fadeOut(300, function () {
        tab_RemoveUser(userid); //具体执行删除方法
    });
    return false;
}
function tab_RemoveUser(removeUserId, tab_RmUsr_bNeedRefresh) {//具体删除方法   
    var ctlHidIds = $("#" + hidNameAllIds); //判断取哪个控件的值
    var ctlHidUserIds = $("#hidAllUserIds");
    var arrSeqIDs = ctlHidIds.val().split(','); //SeqIds
    var arrUserIDs = ctlHidUserIds.val().split(','); //UserIds
    var arrUserNames = null; //username
    if ($("#hidAllUserNames").val() != null) {
        arrUserNames = $("#hidAllUserNames").val().split("→");
    }
    var arrSexs = "";
    if ($("#hidUserSex") && $("#hidUserSex").val() != "") {
        arrSexs = $("#hidUserSex").val().split(',');
    }
    var newUserIds = "";  //这个应该是SeqIds
    var newUserIDs_new = "";  //这个才是新的UserIDs
    var newUserNames = "";
    var newUserSexs = "";
    //add remove jobid
    var hidJobIds = $('#hidAllJobIds');
    var newJobIds = "";
    var arrJobIds = (hidJobIds.length > 0) ? hidJobIds.val().split(',') : '';
    for (j = 0; j < arrSeqIDs.length; j++) {
        if (removeUserId != arrSeqIDs[j]) {
            newUserIds = newUserIds + "," + arrSeqIDs[j];
            newUserIDs_new = newUserIDs_new + "," + arrUserIDs[j];
            if (arrUserNames != null) {
                newUserNames += "→" + arrUserNames[j];
            }
            if (arrSexs != "") {
                newUserSexs += "," + arrSexs[j];
            }
            if (arrJobIds != '') {
                newJobIds += "," + arrJobIds[j];
            }
        } else {
            tmptab_selectedIndex = j;
        }
    }
    if (newUserIds.length > 0) {
        newUserIds = newUserIds.substr(1);
        newUserIDs_new = newUserIDs_new.substr(1);
        newUserNames = newUserNames.substr(1); ;
        if (newUserSexs != "") newUserSexs = newUserSexs.substr(1);
        if (newJobIds != '') newJobIds = newJobIds.substr(1);
    }
    ctlHidIds.val(newUserIds);
    ctlHidUserIds.val(newUserIDs_new);
    if ($("#hidAllUserNames").val() != null) {
        $("#hidAllUserNames").val(newUserNames);
    }
    if ($("#hidUserSex") && newUserSexs != "") {
        $("#hidUserSex").val(newUserSexs);
    }
    if (hidJobIds.length > 0) hidJobIds.val(newJobIds);
    var arrNewUserIds = newUserIds.split(',');
    var arrNewUserIds_new = newUserIDs_new.split(',');
    var arrNewJobIds = newJobIds.split(',');
    var isLast = 0; //记录当前显示节点是否是最后一个节点
    if (tab_selectedIndex > (arrNewUserIds.length - 1)) {
        tab_selectedIndex--; //如果超过最后总大小则向前移动
        isLast = 1;
    }
    //1.如果移除的简历正好是当前浏览的那份，hidSeqID重新取个新的seqId
    //2.如果只剩下一份简历，也需要postback，判断小精灵是否显示
    var ctlHidSingleId = $("#" + hidNameId);
    var ctlHidSingleUserId = $("#hidUserID");
    var hidJobid = $('#hidJobId');
    if (removeUserId == $.trim(ctlHidSingleId.val()) || ctlHidIds.val().split(',').length == 1) {
        //只剩下一份简历，且正好是当前浏览的那份，不需要记录日志(前面加空格)
        if (ctlHidIds.val().split(',').length == 1 && removeUserId != $.trim(ctlHidSingleId.val())) {
            //ctlHidSingleId.val( " " + ctlHidIds.val().split(',')[0]);
            ctlHidSingleId.val(" " + arrNewUserIds[tab_selectedIndex]);
            ctlHidSingleUserId.val(" " + arrNewUserIds_new[tab_selectedIndex]);
        }
        else {
            //ctlHidSingleId.val( ctlHidIds.val().split(',')[0]+" ");
            ctlHidSingleId.val(arrNewUserIds[tab_selectedIndex] + " ");
            ctlHidSingleUserId.val(arrNewUserIds_new[tab_selectedIndex] + " ");
        }
        if (hidJobid.length > 0) hidJobid.val(arrNewJobIds[tab_selectedIndex]);
        tmptab_selectedIndex = -1; //设置为删除标识，因为删除的是当前的节点，所以上一个访问的节点不存在了
        if (tab_RmUsr_bNeedRefresh == null || tab_RmUsr_bNeedRefresh) {
            __doPostBack(hidNameId, '');
        }
    }
    else {
        if (typeof (varIsResumeView) == "undefined")  //ResumeView的加载提示和Folder页面的不一样
        {
            //hideMaskDiv();
            hideLoadDiv();
        }
        else {
            hideLoadDiv();
        }
        if (tmptab_selectedIndex < tab_selectedIndex && !isLast) tab_selectedIndex--; //删除当前节点之前的节点，索引要减少一个(当前显示为最后一个节点在上边已经减1处理了)
        tab_BuildUserList(tab_currentPage, 1);
    }
}
function tab_nextResume() {//下一个按钮    
    if (tab_groupIndex == Math.ceil(tab_countResumes / 5)) return; //已经到最后一组了,modify by chaowei.wang 20160121
    //tab_ShowUser(tab_selectedIndex+1);
    tab_preNextResume(1);
}
function tab_preResume() {//上一个按钮
    if (tab_groupIndex == 1) return; //已经到第一组了
    //tab_ShowUser(tab_selectedIndex-1);
    tab_preNextResume(0);
}
function tab_preNextResume(isNext) {//只有多于5个才进行分组 modify by chaowei.wang 20160122 逻辑修改，翻到第二页时，第一个为新一页的第一个，而不是第一页的最后一个。
    var p, indexStart = 0, indexEnd = 0, tab_num = 0;
    tab_num = Math.ceil(tab_countResumes / 5);
    if (isNext == 0 && tab_countResumes > 5) {
        tab_groupIndex--;
        indexStart = 5 * (tab_groupIndex - 1);
        indexEnd = indexStart + 4;
    } else if (isNext == 1 && tab_countResumes > 5) {
        indexStart = 5 * tab_groupIndex;
        tab_groupIndex++;
        indexEnd = indexStart + ((tab_groupIndex == tab_num) ? tab_countResumes % 5 - 1 : 4);
    } else if (tab_selectedIndex != 0 && tab_countResumes > 5) {
        indexStart = (tab_selectedIndex - tab_selectedIndex % 5); //节点为中间节点时，找最近的分界节点
        indexEnd = Math.min(indexStart + 4, tab_countResumes - 1);
        tab_groupIndex = Math.ceil((indexEnd + 1) / 5);  //设置组索引
    }
    for (var i = 0; i <= indexEnd; i++) {
        p = gid(tab_tblNameUserList + i);
        if (i < indexStart) {
            p.style.display = 'none';
        } else {
            p.style.display = 'block';
        }
    }

    gid('tab_lblTabPos').innerHTML = tab_groupIndex + "/" + tab_num;
}
function tab_InitChkUsers() {//初始化被选中的简历复选框
    var objChk = document.getElementsByName("tab_chkUserID");
    var hidCheckedIds = "," + $("#" + hidNameCheckedIds).val() + ",";
    var isAllCheck = false;
    for (var i = 0; i < objChk.length; i++) {
        isAllCheck = true;
        if (hidCheckedIds.indexOf("," + $(objChk.item(i)).attr("value") + ",") > -1) {
            objChk.item(i).checked = true;
        }
        else {
            isAllCheck = false;
        }
    }
    gid("tab_chkAllUserID").checked = isAllCheck;
    tab_calculateChkNum();
}
function tab_ChkAllUsers(ctl) {//all check全选
    var objChk = document.getElementsByName("tab_chkUserID");
    var newCheckedUserIds = "";
    for (var i = 0; i < objChk.length; i++) {
        objChk.item(i).checked = ctl.checked;
    }
    tab_calculateChkNum();
}
function tab_ChkUser() {
    tab_calculateChkNum();
}
function tab_calculateChkNum() {//calculate the number of checked
    var objChk = document.getElementsByName("tab_chkUserID");
    var newCheckedUserIds = "";
    var strUserIds = "";       //add by guoziheng
    var jobids = "";
    var num = "0";
    for (var i = 0; i < objChk.length; i++) {
        if (objChk.item(i).checked) {
            newCheckedUserIds = newCheckedUserIds + "," + $(objChk.item(i)).attr("value");
            strUserIds = strUserIds + "," + $(objChk.item(i)).attr("value2");
            if ($(objChk.item(i)).attr("value3")) {
                jobids = jobids + "," + $(objChk.item(i)).attr("value3");
            }
            else {
                jobids = jobids + ",";
            }
            num++;
        }
    }
    if (newCheckedUserIds.length > 0) {
        newCheckedUserIds = newCheckedUserIds.substr(1);
        strUserIds = strUserIds.substr(1); //add by guoziheng
    }
    if (jobids.length > 0) {
        jobids = jobids.substr(1);
    }
    $("#" + hidNameCheckedIds).val(newCheckedUserIds);
    $("#hidCheckedUserIds").val(strUserIds); //add by guoziheng
    $("#hidCheckedJobIds").val(jobids);
    $("#tab_lblChkNum").html(num);
    if (num == objChk.length) {
        $("#tab_chkAllUserID").attr("checked", true)
    } else {
        $("#tab_chkAllUserID").attr("checked", false)
    }
}
function tab_AddUser(index, strSeqID, userName, strUserID, strSex, strJobId) {//添加用户到列表
    var oldUserName = "";
    //if (HasHtmlTag(userName))
    //    userName = "";
    var fontStyle = "font-size:11px;";
    if (userName == "") {
        userName = strSeqID;
        //oldUserName=strSeqID;
        //宽度为9个数字，大于9个就显示...
        userName = tab_CheckStrLength(userName, 10);
    }
    else {
        //oldUserName=userName;
        //宽度为4个中文，大于4个就显示...
        userName = tab_CheckStrLength(userName, 8);
        fontStyle = "";
    }
    //add jobid
    var value3 = '';
    if (strJobId) value3 = ' value3="' + strJobId + '"';
    //add 子节点标签
    var divUserList = gid("tab_divUserList");
    var pImgSrc = IMGPATH + "image/commonnew/icon.gif";
    var newP = document.createElement("p");
    newP.value = strSeqID;
    newP.id = tab_tblNameUserList + index;
    newP.className = "rview_tab1_bg";
    var pHtml = '<span style="display:block;float:left;"><input type="checkbox" name="tab_chkUserID" onclick="tab_ChkUser()" id="tab_chkUserID' + index + '" value="' + strSeqID + '" value2="' + strUserID + '"' + value3 + 'chkIndex="' + index + '" /></span>';
    pHtml += '<a name="tab_p' + index + '"></a><a name="tab_lnkUserId" style="cursor:pointer;" id="tab_lnkUserId' + index + '" value="' + strSeqID + '" value2="' + strUserID + '" href="#" onclick="javascript:tab_ShowUser(' + index + ');"><span style="display:block;width:130px;float:left;margin-top:0px;_margin-top:1px;*margin-top:1px;' + fontStyle + '" title="' + oldUserName + '">' + userName + '</span></a>';
    pHtml += '<span style="display:block;float:right;cursor:pointer;height:18px;width:18px;padding-top:3px;" onclick="tab_DeleteUser(' + strSeqID + ',' + index + ')" value="' + strSeqID + '"><a id="tab_chkImg' + index + '" style="position:static" class="candidate-ResumeView-icon candidate-ResumeView-icon_remove_block"></a></span>';
    newP.innerHTML = pHtml;
    divUserList.appendChild(newP);
    //    if ($("#hidUserSex") && $("#hidUserSex").val() != "") {
    //        if (strSex && strSex == "1") {
    //            $("#img" + index).attr("src", ImgWoman);
    //        } else if (strSex && strSex == "n") {
    //            $("#img" + index).css("display", "none");
    //        } else {
    //            $("#img" + index).attr("src", ImgMan);
    //        }
    //    } else {
    //        $("#img" + index).css("display", "none");
    //    }
}
function tab_CheckStrLength(value, maxLen) {//截取用户名长度
    var str, Num = 0;
    var tmpstr = "";
    try {
        for (var i = 0; i < value.length; i++) {
            str = value.substring(i, i + 1);
            if (str <= "~")  //对双字节字特殊处理
                Num += 1;
            else
                Num += 2;
            if (Num > maxLen) {//超过指定长度，截断
                if (maxLen == 10) {
                    return tmpstr.substring(0, 8) + "...";
                }
                return tmpstr + "...";
            }
            tmpstr += value.charAt(i);
        }
    } catch (ex) { }
    return tmpstr;
}
/*-------------------------页签式的无忧小精灵批量处理脚本added by linsendu 20110824-end-------------------------------------*/

var lastScrollY1 = 0;
function SetCvHeight_folder() {
    if (gid("cvtext") != null) {
        var txtMessage = gid("cvtext");
        var splitStringArray = txtMessage.value.split("\n");
        var messageContentLines = splitStringArray.length + GetStringLength(txtMessage.value) / 100;
        var height = Math.round(messageContentLines * 14);
        if (height < 20) {
            height = 20;
        }
        gid("cvtext").style.height = height + "px";
    }
}

//初始化按钮状态
function RV_InitButton() {
    if ($("#hidAllSeqIds").val() == $("#hidSeqID").val() || $("#hidAllSeqIds").val() == "" || $("#hidAllSeqIds").val().indexOf(',') < 0 || $("#hidAllUserIds").val() == "") {
        $("#bt_Pre").css("display", "none");
        $("#bt_Next").css("display", "none");
        return;
    }
    //    $("#bt_Pre").attr("disabled","");
    //    $("#bt_Next").attr("disabled","");
    $("#bt_Pre").css("display", "");
    $("#bt_Next").css("display", "");
    if (document.getElementsByName("bt_Close") != null) { $("#bt_Close").css("display", ""); }
    var arrAllSeqIds = $("#hidAllSeqIds").val().split(',');
    for (i = 0; i < arrAllSeqIds.length; i++) {
        if (arrAllSeqIds[i] == $("#hidSeqID").val()) {
            if (i == 0) { $("#bt_Pre").css("visibility", "hidden"); }
            if (i == arrAllSeqIds.length - 1) { $("#bt_Next").css("visibility", "hidden"); }
        }
    }
}
//定时定位小精灵菜单
function InitMenuPostion() {
    var menuTopval = 60;
    var CurMenu = gid("divMainMenuElf");
    if (CurMenu) {
        var diffY1;
        if (document.documentElement && document.documentElement.scrollTop)
            diffY1 = document.documentElement.scrollTop;
        else if (document.body)
            diffY1 = document.body.scrollTop
        else { /*Netscape stuff*/ }
        percent1 = .1 * (diffY1 - lastScrollY1);
        if (percent1 > 0)
            percent1 = Math.ceil(percent1);
        else
            percent1 = Math.floor(percent1);
        lastScrollY1 = lastScrollY1 + percent1;

        //        if (window.document.body.parentNode.scrollTop==0){                    
        CurMenu.style.top = menuTopval + "px";
        CurMenu.style.display = "";
        //        }else{                    
        //            CurMenu.style.top = menuTopval + window.document.body.parentNode.scrollTop +percent1+"px";
        //            CurMenu.style.display = "";
        //        }
        var tinyboxview = gid('tinyboxview');
        if (tinyboxview && tinyboxview.style && tinyboxview.style.display == 'block') {
            TINY.box.setToObj();
        }
        var feedbackguide = $(".wy-baseline00");
        if (feedbackguide.length > 0) {
            feedbackguide.removeAttr("style");
        }
        var feedbackbtn = $(".feedback--bottom");
        if (feedbackbtn.length > 0) {
            feedbackbtn.removeAttr("style");
        }
    }
    timeobj = window.setTimeout("InitMenuPostion()", 50);
}
//-----  打印控制语句  ---------- 
//window.onbeforeprint=beforePrintResume; 
//window.onafterprint=afterPrintResume; 需放在页面中进行
function PrintResume() {
    if (InboxEngine.AddResumeLog) {
        InboxEngine.AddResumeLog("8");
    }

    if (gid("resumeViewFolderType")) {
        var resumeViewType = gid("resumeViewFolderType").value;
        if (resumeViewType == "EMP") {
            ajaxSendRequest("../GlobalLogAjax.aspx?bigCode=12&code=0101");
        } else if (resumeViewType == "BAK") {
            ajaxSendRequest("../GlobalLogAjax.aspx?bigCode=13&code=0101");
        }
    }
    var varSeqid = gid("hidCheckedSeqIds");
    if (varSeqid && varSeqid.value.length != 0) {
        var aa = document.getElementById("form1").action;
        //如果是暂存夹的批量打印，转到ResumesBetaPreview页面
        if (gid("resumeViewFolderType").value.toLowerCase() == "temp") {
            document.getElementById("form1").action = "ResumesBetaPreview.aspx";
        }
        else {
            document.getElementById("form1").action = "ResumesPreview.aspx?ViewType=" + gid("hidViewType").value + "&ChartType=" + gid('hidChartType').value;
        }
        document.getElementById("form1").target = "_blank";
        document.getElementById("form1").submit();
        var URL = window.location.href;
        URL = URL.substring(URL.lastIndexOf("/") + 1, URL.length);
        document.getElementById("form1").target = "_self";
        document.getElementById("form1").action = URL;

        return false;
    }
    PrintStart(); //开始打印
    return false;
}
function PrintStart() {
    beforePrintResume();
    try {
        window.print();
    }
    catch (e) { }
    if (!$.browser.mozilla) {
        afterPrintResume();
    }
}
function beforePrintResume() {//打印前的显示控制
    var CurMenu = gid("divMainMenuElf");
    if (CurMenu) CurMenu.style.display = "none";
    var wyntgg = gid("wyntgg");
    if (wyntgg) wyntgg.style.display = "none";
    var tinyboxview = gid('tinyboxview');
    if (tinyboxview) {
        tinyboxview.style.display = 'none';
    }
    var feedbackguide = $(".wy-baseline00");
    if (feedbackguide.length > 0) {
        feedbackguide.css("display", "none");
    }
    var feedbackbtn = $(".feedback--bottom");
    if (feedbackbtn.length > 0) {
        feedbackbtn.css("display", "none");
    }
    //页签切换时，存在iframe的打印通过div实现
    var ifr = gid("ifrInfo");
    var ifrdiv = gid("ifrPrintInfo");
    var divinfo = gid("divInfo");
    if (ifr && ifrdiv && divinfo.style.display == 'none') {
        ifrdiv.innerHTML = ifr.contentWindow.document.body.innerHTML.replace(/<form[^>]*>/gi, "");
        ifr.style.display = 'none';
        ifrdiv.style.display = 'block';
        ifrdiv.style.paddingTop = "8px";
    }
    var divRecom = gid("divRecom");
    if (divRecom) divRecom.style.display = "none";
}
function beforePrint_folder()//打印前的显示控制
{
    var CurMenu = gid("SubMenuInBox") ? gid("SubMenuInBox") : (gid("SubMenuInterview") ? gid("SubMenuInterview") : (gid("SubMenuCHr") ? gid("SubMenuCHr") : gid("SubMenuRub")));
    if (gid("MainMenu"))
        gid("MainMenu").style.display = "none";
    if (CurMenu)
        CurMenu.style.display = "none";
    var tinyboxview = gid('tinyboxview');
    if (tinyboxview) {
        tinyboxview.style.display = 'none';
    }
    //页签切换时，存在iframe的打印通过div实现
    var ifr = gid("ifrInfo");
    var ifrdiv = gid("ifrPrintInfo");
    var divinfo = gid("divInfo");
    if (ifr && ifrdiv && divinfo.style.display == 'none') {
        ifrdiv.innerHTML = ifr.contentWindow.document.body.innerHTML.replace(/<form[^>]*>/gi, "");
        ifr.style.display = 'none';
        ifrdiv.style.display = 'block';
        ifrdiv.style.paddingTop = "8px";
    }

    //页签切换时，存在iframe的打印通过div实现
    var ifrifrImport = gid("ifrImport");
    var ifrifrImportdiv = gid("ifrImportInfo");
    if (ifrifrImport && ifrifrImportdiv && divinfo.style.display != 'none') {
        ifrifrImportdiv.innerHTML = ifrifrImport.contentWindow.document.body.innerHTML.replace(/<form[^>]*>/gi, "");
        ifrifrImport.style.display = 'none';
        ifrifrImportdiv.style.display = 'block';
        ifrifrImportdiv.style.paddingTop = "8px";
    }
}
function afterPrintResume() {//打印后的显示控制
    var CurMenu = gid("divMainMenuElf");
    if (CurMenu) CurMenu.style.display = "block";
    var tinyboxview = gid('tinyboxview');
    if (tinyboxview) {
        tinyboxview.style.display = 'block';
    }
    //页签切换时，存在iframe的打印通过div实现
    var ifr = gid("ifrInfo");
    var ifrdiv = gid("ifrPrintInfo");
    var divinfo = gid("divInfo");
    if (ifr && ifrdiv && divinfo.style.display == 'none') {
        ifrdiv.innerHTML = "";
        ifr.style.display = '';
        ifrdiv.style.display = 'none';
    }
    var divRecom = gid("divRecom");
    if (divRecom) divRecom.style.display = "block";
    var wyntgg = gid("wyntgg");
    if (wyntgg) wyntgg.style.display = "block";
}
function afterPrint_folder()//打印后的显示控制
{
    var CurMenu = gid("SubMenuInBox") ? gid("SubMenuInBox") : (gid("SubMenuInterview") ? gid("SubMenuInterview") : (gid("SubMenuCHr") ? gid("SubMenuCHr") : gid("SubMenuRub")));
    if (CurMenu)
        CurMenu.style.display = "block";
    var tinyboxview = gid('tinyboxview');
    if (tinyboxview) {
        tinyboxview.style.display = 'block';
    }
    //页签切换时，存在iframe的打印通过div实现
    var ifr = gid("ifrInfo");
    var ifrdiv = gid("ifrPrintInfo");
    var divinfo = gid("divInfo");
    if (ifr && ifrdiv && divinfo.style.display == 'none') {
        ifrdiv.innerHTML = "";
        ifr.style.display = '';
        ifrdiv.style.display = 'none';
    }

    //页签切换时，存在iframe的打印通过div实现
    var ifrifrImport = gid("ifrImport");
    var ifrifrImportdiv = gid("ifrImportInfo");
    if (ifrifrImport && ifrifrImportdiv && divinfo.style.display != 'none') {
        ifrifrImportdiv.innerHTML = "";
        ifrifrImport.style.display = '';
        ifrifrImportdiv.style.display = 'none';
    }
}
// 功能：显示返回顶部按钮
// 作者：Lisa Chen 2012-11-19
// *********************************************************************************** //
function displayToTopBtn() {
    var body;
    if (navigator.userAgent.indexOf("Opera") > 0) {
        body = window.opera;
    }
    else {
        body = window;
    }

    $(body).scroll(function () {
        if ($("#bt_ToTop") != null && $("#bt_ToTop") != undefined) {
            var scrollHeight;                               //滚动轴偏移高度
            var browseHeight;                               //页面可见高度
            var topHeight;                                  //按钮顶点位置
            var selfHeight = $("#bt_ToTop").height();       //按钮本身高度

            //由于各种浏览器的取值法不同因此需要以不同方式取出页面可见高度和滚动轴偏移高度
            if (navigator.userAgent.indexOf("MSIE") >= 0)       //IE
            {
                browseHeight = document.documentElement.clientHeight;
                scrollHeight = document.documentElement.scrollTop;
            }

            if (navigator.userAgent.indexOf("Firefox") >= 0)    //火狐
            {
                browseHeight = document.documentElement.clientHeight;
                scrollHeight = document.documentElement.scrollTop;
            }

            if (navigator.userAgent.indexOf("Chrome") >= 0)     //google
            {
                browseHeight = document.documentElement.clientHeight;
                scrollHeight = document.body.scrollTop;
            }

            if (navigator.userAgent.indexOf("Safari") >= 0)     //苹果
            {
                browseHeight = document.documentElement.clientHeight;
                scrollHeight = document.body.scrollTop;
            }

            if (navigator.userAgent.indexOf("Opera") >= 0)      //Opera
            {
                browseHeight = document.documentElement.clientHeight;
                scrollHeight = document.documentElement.scrollTop;
            }

            topHeight = scrollHeight + browseHeight - selfHeight - 2;

            //滚动轴偏移量为零时，不显示按钮
            if (scrollHeight == 0) {
                $("#bt_ToTop").css("display", "none");
            }
            //滚动轴偏移量大于零时，显示按钮
            else {
                var parentHeight = $("#bt_ToTop").parent().height();         //按钮所在的单元格高度

                //设置按钮顶部位置，为防止按钮顶点位置低于所在单元格的底部位置
                //按钮顶点位置应小于单元格底部位与按钮高度的差
                //若超出差值则顶点位置即差值
                if (topHeight < parentHeight - selfHeight) {
                    $("#bt_ToTop").css("top", topHeight + "px");
                }
                else {
                    $("#bt_ToTop").css("top", parentHeight - selfHeight + "px");
                }
                $("#bt_ToTop").css("display", "");
            }
        }
    });
}
//add by jason 20100224释放小精灵
function CloseTimeout() {
    if (timeobj != undefined) window.clearTimeout(timeobj);
}
//取消暂存夹和无忧搜索页面中简历详细页面的批量操作
function checkTempDispose(lang) {
    var msg = lang == 'EN-US' ? "The operation is only for this resume!" : "该操作只针对此简历操作！";
    var resumeViewFolderType = gid("resumeViewFolderType") != null ? gid("resumeViewFolderType").value : "";
    var seqIDs = gid("hidCheckedSeqIds");
    var selectVal = seqIDs.value;
    var currentVal = $("#hidSeqID").val()
    var seqIDsCount = 0;
    if (seqIDs) {
        seqIDsCount = seqIDs.value.split(',').length;
    }
    if (resumeViewFolderType == "TEMP" && seqIDsCount > 1) {
        EHR.ShowBox(msg, 350, 0, "", true);
        return false;
    }
    //排除暂存夹和无忧搜索页面中批量进入简历详细页面，选中未下载但在已下载页面中操作的情况
    else if (resumeViewFolderType == "TEMP" && selectVal && selectVal != currentVal) {
        EHR.ShowBox(msg, 350, 0, "", true);
        return false;
    }
    return true;
}
function checkForward() {
    var forward = gid("hidType") != null ? gid("hidType").value : "";
    var resumeViewFolderType = gid("resumeViewFolderType") != null ? gid("resumeViewFolderType").value : "";
    if (forward == "Temp" && resumeViewFolderType == "TEMP") {
        return true;
    }
    else {
        return false;
    }
}
//取消收件箱和人才夹页面中简历详细页面的批量操作
function checkInboxDispose() {
    var msg = "该操作只针对此简历操作！";
    var hidFolder = gid("hidFolder") != null ? gid("hidFolder").value : "";
    var seqIDs = gid("hidCheckedSeqIds");
    var selectVal = seqIDs.value;
    var currentVal = $("#hidSeqID").val()
    var seqIDsCount = 0;
    if (seqIDs) {
        seqIDsCount = seqIDs.value.split(',').length;
    }
    if ((hidFolder == "EMP" || hidFolder == "BAK") && seqIDsCount > 1) {
        EHR.ShowBox(msg, 350, 0, "", true);
        return false;
    }
    //排除暂存夹和无忧搜索页面中批量进入简历详细页面，选中未下载但在已下载页面中操作的情况
    else if ((hidFolder == "EMP" || hidFolder == "BAK") && selectVal && selectVal != currentVal) {
        EHR.ShowBox(msg, 350, 0, "", true);
        return false;
    }
    return true;
}
//职业征信跳转
function creditSubmit() {
    EHR.Common_AsyncAddLog('7', '1', '');
    window.open("../BgSurvey/CreditIntroduce.aspx");
}
//*------------小精灵页签切换js-----------------*//
var timer3, tabIndex;
function setIfr(status, uid) {
    var ifr = gid('ifrInfo');
    var divi = gid('divInfo');
    var span18 = gid('span18clear');
    var tab1 = gid('tabJL1');
    var tab2 = gid('tabCZ2');
    var tab3 = gid('tabTX3');
    var tabCvletter = gid('tabCvletter');
    switch (status) {
        case 1:
            if (divi) divi.style.display = '';
            if (ifr) ifr.style.display = 'none';
            if (span18) span18.style.display = 'none';
            if (tab1) tab1.className = "active";
            if (tab2) tab2.className = "";
            if (tab3) tab3.className = "";
            if (tabCvletter) tabCvletter.style.display = '';
            tabIndex = 1;
            window.clearTimeout(timer3);
            return false;
            break;
        case 2:
            regIframeLoad(ifr, 2);
            if (ifr) ifr.src = "ResumeOprLog.aspx?UserID=" + uid;
            if (span18) span18.style.display = 'none';
            if (tab1) tab1.className = "";
            if (tab2) tab2.className = "active";
            if (tab3) tab3.className = "";
            if (ifr) ifr.style.display = '';
            if (divi) divi.style.display = 'none';
            if (tabCvletter) tabCvletter.style.display = 'none';
            break;
        case 3:
            regIframeLoad(ifr, 3);
            var strFrom = gid('hidFolder') == null ? "" : gid('hidFolder').value + "_MSG"; //从“通讯记录”里发消息时strFrom定为EMP_MSG的形式，用以和原来的EMP区别
            if (ifr) ifr.src = "../Message/MessageRecord_Min.aspx?IsView=1&UserID=" + uid + "&strFrom=" + strFrom;
            if (span18) span18.style.display = 'inline';
            if (tab1) tab1.className = "";
            if (tab2) tab2.className = "";
            if (tab3) tab3.className = "active";
            if (ifr) ifr.style.display = '';
            if (divi) divi.style.display = 'none';
            if (tabCvletter) tabCvletter.style.display = 'none';
            break;
    }
    $("#bt_ToTop").css("display", "none");
    return false;
}
function regIframeLoad(ifr, tabI) {
    tabIndex = tabI;
    if (ifr) ifr.height = "0px";
    if (ifr.attachEvent) {
        ifr.attachEvent("onload", resizeIfr);
    }
    else {
        ifr.onload = function () {
            resizeIfr();
        }
    }
}
function resizeIfr() {
    var ifr = gid('ifrInfo');
    if (ifr) {
        if (ifr.contentWindow && ifr.contentWindow.document.body.scrollHeight) {
            var contentHeight = parseInt(ifr.contentWindow.document.body.scrollHeight);
            //if(tabIndex==2)contentHeight+=20;
            ifr.height = contentHeight + 'px';
        }
        if (tabIndex == 3) {
            timer3 = window.setTimeout("resizeIfr()", 50);
        } else {
            window.clearTimeout(timer3);
        }
    }
}
//2012-08-20 added by linsendu for 第三方导入ifr自适应 
function resizeIfrImport(ifrImportObj) {
    var ifr = ifrImportObj;
    if (ifr) {
        if (ifr.contentWindow && ifr.contentWindow.document.body.scrollHeight) {
            var contentHeight = parseInt(ifr.contentWindow.document.body.scrollHeight);
            ifr.height = contentHeight + 20 + 'px';
        }
    }
}
//*------------小精灵页签切换js---end--------------*//
//上一封 下一封 关闭逻辑
function RV_OpenResume(iFlag) {
    var iNum = -1;
    var arrAllSeqIds = $("#hidAllSeqIds").val().split(',');
    for (i = 0; i < arrAllSeqIds.length; i++) {
        if (arrAllSeqIds[i] == $("#hidSeqID").val()) {
            if (iFlag == 0) {
                if (arrAllSeqIds.length < 2) {
                    window.close();
                }
                else {
                    tab_DeleteUser($("#hidSeqID").val(), i);
                }
                return false;
            }
            iNum = i + iFlag * 1;
        }
    }
    if (iNum >= 0 && iNum <= arrAllSeqIds.length) {
        tab_ShowUser(iNum);
    }
}
/*新小精灵菜单start*/
var canClose = false;
function moveResumeSubMenu(pObj) {
    canClose = false;
    //EHR.setToObj(pObj,EHR.$("moveResumeSubDiv"));
    var pos = getPos_menu(pObj);
    var subDiv = gid("moveResumeSubDiv");
    subDiv.style.display = "block";
    subDiv.style.left = (pos.left - subDiv.offsetWidth + 20) + "px";
    subDiv.style.top = (pos.top) + "px";
    pObj.className = "rself_liston";
}
function hidMainMenu(pObj) {
    setTimeout(function () {
        if (canClose) {
            gid('moveResumeSubDiv').style.display = 'none';
            pObj.className = "rself_listoffsub";
        }
    }, 50);
}
function mouseInSubDiv(subDiv, isOver) {
    canClose = false;
    if (isOver) {
        subDiv.style.display = 'block';
        gid('moveResumeDiv').className = 'rself_liston';
    } else {
        subDiv.style.display = 'none';
        gid('moveResumeDiv').className = 'rself_listoffsub';
    }
}
var canCloseDiv = false;
function processResumeSubMenu(pObj) {
    canCloseDiv = false;
    //EHR.setToObj(pObj,EHR.$("moveResumeSubDiv"));
    var pos = getPos_menu(pObj);
    var subDiv = gid("processResumeSubDiv");
    subDiv.style.display = "block";
    subDiv.style.left = (pos.left - subDiv.offsetWidth + 20) + "px";
    subDiv.style.top = (pos.top) + "px";
    pObj.className = "rself_liston";
}

function hidprocessMainMenu(pObj) {
    setTimeout(function () {
        if (canCloseDiv) {
            gid('processResumeSubDiv').style.display = 'none';
            pObj.className = "rself_listoffsub";
        }
    }, 50);
}
function processInSubDiv(subDiv, isOver) {
    canCloseDiv = false;
    if (isOver) {
        subDiv.style.display = 'block';
        gid('processResumeDiv').className = 'rself_liston';
    } else {
        subDiv.style.display = 'none';
        gid('processResumeDiv').className = 'rself_listoffsub';
    }
}
function getPos_menu(obj) {//获取位置
    var left = 0, top = 0;
    left += obj.offsetLeft;
    top += obj.offsetTop;
    return { left: left, top: top };
}
/*新小精灵菜单end*/

function ShowMatchSetDiv() {
    if ($.trim($("#matchimg_table").text()) == "") {
        var load = "<tr><td><div id='matchimg_table_div' style='background-color:#fff;text-align:center;font-weight:bold;height:192px;color:#030000;font-size:14px;width:444px;'><img src='" + GLOBAL_IMAGEPATH + "commonnew/loading.gif' style='margin-top:50px'/></div></td></tr>";
        $("#matchimg_table").html(load);
        $.ajax({
            url: "../ajax/Resume/GlobalMatchScore.aspx",
            type: "POST",
            async: true,
            dataType: "xml",
            data: MatchSetData,
            success: function (result) {
                var msgtype = $(result).find("msgtype").eq(0).text();
                if (msgtype == "1") {
                    var html = "";
                    html += GetMatchTr(MatchSetTitle.ItemFunction, $(result).find("matching_fun").eq(0).text());
                    html += GetMatchTr(MatchSetTitle.ItemIndustry, $(result).find("matching_ind").eq(0).text());
                    html += GetMatchTr(MatchSetTitle.ItemMajor, $(result).find("matching_major").eq(0).text());
                    html += GetMatchTr(MatchSetTitle.ItemDegree, $(result).find("matching_degree").eq(0).text());
                    html += GetMatchTr(MatchSetTitle.ItemExperience, $(result).find("matching_workyear").eq(0).text());
                    html += GetMatchTr(MatchSetTitle.ItemAge, $(result).find("matching_age").eq(0).text());
                    html += GetMatchTr(MatchSetTitle.ItemSalary, $(result).find("matching_salary").eq(0).text());
                    html += GetMatchTr(MatchSetTitle.ItemLanguage, $(result).find("matching_lang1").eq(0).text());
                    html += GetMatchTr(MatchSetTitle.ItemResidency, $(result).find("matching_area").eq(0).text());
                    $("#matchimg_table").html(html);
                }
                else
                    ShowMatchEmpty();
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                ShowMatchEmpty();
            }
        });
    }
    $("#matchimg").show();
}
function GetMatchTr(title, val) {
    var html = "<tr><td height='24' width='90' align='left' style='overflow: hidden; text-overflow: ellipsis;white-space: nowrap; text-indent: 1.5em;'><a style='color: black;' title=''>";
    html += title + "</a></td><td width='80%' height='21' align='left'><div class='line_body'><div class='line_main'>";
    var line_main = "line_main_green";
    if (val <= 50) line_main = "line_main_red";
    html += "<span class='" + line_main + "' style='width: " + val + "%;'></span></div></div><span class='line_num'>" + val + "%</span></td></tr>";
    return html;
}
function ShowMatchEmpty() {
    $("#matchimg_table_div").html("<span style='line-height:180px'>" + MatchSetTitle.MatchEmptyTitle + "</span>");
}
/*---------------------view页面js--------------------------------------*/
function view_getReplace() {
    if (gid("RersumeView_btnDownLoad") != null && gid("RersumeView_btnDownLoad").disabled && gid("UndownloadLink") != null) {
        var objDiv = gid("UndownloadLink");
        var strContent = objDiv.innerHTML;
        var reBegin1 = new RegExp("点击查看联系方式！", "ig");
        var reBegin2 = new RegExp("Click to view contact!", "ig");
        strContent = strContent.replace(reBegin1, "").replace(reBegin2, "");
        objDiv.innerHTML = strContent;
    }
}
//判断滚动条距离页面底部300px时加载简历推荐区块
function GetRecommendResume() {
    var windowHeight = $(window).height(); //浏览器窗口高度
    var pageHeight = $.browser.msie ? GetIEDocumentProp('Height') : $(document).height(); //页面总高度
    var scrollTop = $(window).scrollTop(); //滚动条top
    var isMaskShowed = $("#DivMask").css("display") == "block" || $(".ui-widget-overlay").length > 0; //判断是否有遮罩层
    var filter = $('#_filterstr').val()== undefined ? "" : $('#_filterstr').val();
    var prestr = $('#_prestr').val()== undefined ? "" : $('#_prestr').val();
    if ((scrollTop >= pageHeight - windowHeight - 300) && !isMaskShowed && !isRecommendAreaShowed) {
        isRecommendAreaShowed = true;
        $(window).unbind("scroll", GetRecommendResume); //取消绑定
        $("#tabCZ2").die(); //取消绑定
        $("#tabTX3").die(); //取消绑定
        $.ajax(
        {
            type: "get",
            async: true,
            dataType: "jsonp",
            jsonp: "callback",
            url: recommendAjaxUrl,
            data: "userid=" + $("#hidUserID").val() + "&lang=" + cvRcmdIsEn + "&s=" + cvRcmdSId + "&ctmid=" + cvRcmdCtmid + "&hruid=" + cvRcmdHruid + "&t=" + cvRcmdTimeStamp + "&key=" + accesskey+"&ischa="+$('#hidischa').val()+"&filter="+filter+"&_prestr="+prestr+"&_downitem="+$('#hiddown').val(),
            success: function (result) {
                var msgtype = result == null ? "" : result.message;
                if (msgtype == "OK") {
                    //$("#resumeRecommend").html(unescape(result.content));
                    //$("#resumeRecommend").show();
                    $("#divRecom").remove();
                    $("[id*='{0}']".format('resumeRecommend')).after(unescape(result.content));
                    $("#divRecom").show();
                    ajaxSendRequest("/GlobalLogAjax.aspx?recommendLog=1");
                }else if(msgtype == "timeout" || msgtype == "Empty")
                {
                    var top = $('#divRecom').height() / 2;
                    var left = $('#divRecom').width() / 2 - 10;
                    $('#mess').html("无更多推荐简历");
                    $("#mess").css('display', '');
                    $('#mess').css({ 'top': top + 'px', 'left': left + 'px' }).stop(true, true).fadeIn("slow").delay(1000).fadeOut(1000, "linear");
                }
            }
        });
    }
}
// 获取ie下页面属性值（高度或宽度）
// 参数name：Height or Width
function GetIEDocumentProp(name) {
    return Math.max(
        document.documentElement["client" + name],
        document.documentElement["scroll" + name],
        document.body["scroll" + name]
    );
}
//当简历数小于8时，只随机显示4份简历
function  fetchRecommCVByRandom()
{
EHR.Common_AsyncAddLog("7", "24", '1' + str_char22 + page_code);//记录日志
var isMore = $('#_nomore').val();
if(isMore== "1") {
//$('#hidischa').val('1');
    //<8份简历时循环
 if($('#_itemsUnder8').val()!="") FetchRecomDataUnder8();
 }
 else if(isMore== "0")
 {
   var top = $('#divRecom').height() / 2;
   var left = $('#divRecom').width() / 2 - 10;
   $('#mess').html("无更多推荐简历");
   $("#mess").css('display', '');
   $('#mess').css({ 'top': top + 'px', 'left': left + 'px' }).stop(true, true).fadeIn("slow").delay(1000).fadeOut(1000, "linear");
 }else
 {
   // $('#hidischa').val('1');
    isRecommendAreaShowed = false;
    GetRecommendResume();
 }
}
function rndRecomm(lowerValue,upperValue)
{
// var lowerValue =1;
// var upperValue = recomId.length;
var  Ids = new Array();
var ic= 0;
while(true)
{
    if( Ids.length ==4 ) break;
    var  Id= num(lowerValue,upperValue);
    if(parseInt($.inArray(Id, Ids)) < 0 )  
    {
         Ids.push(Id);
    } 
}
return Ids;
}

function num(lowerValue,upperValue)
{
var num = Math.floor(Math.random() * (upperValue - lowerValue + 1) + lowerValue );
return num;
}
function  FetchRecomDataUnder8()
{
var prestr="";
 var recomIds = $('#_prestr').val();
var recomId = recomIds.split(',');
var radomIds = rndRecomm(1,recomId.length);
var  items =$('#_itemsUnder8').val();
var  downitems = $("#hiddown").val();
//重新输出推荐简历
var  recomhtml =  "<div class=\"ev-ct\" id=\"divRecom\" style =\"display: none;\"><div class=\"list-main\" style=\"width:900px;\"><div id =\"mess\" style =\"display: none;\" class=\"ev-warn-tips010\"></div> <div class=\"list-box clearfix ev-padding010\" style=\"width:900px;\">";
recomhtml += "<div class=\"ev-blue-bar09 clearfix\" style=\"background-color:#3876c1;\"><div class=\"page-ft-l ev-top-bar09 ev-padding008\">";
recomhtml += lang=="en" ? "Guess you like" : "猜你喜欢";
recomhtml += "</div><a href=\"javascript:void(0);\" id=\"_change\" class=\"page-ft-r ev-top-bar09 ev-next09 ev-margin30\"><span>";
recomhtml += lang=="en" ? "Change" : "换一换" ;
recomhtml += "</span><i class=\" icon icon_change ev-margin006\"></i></a></div>" ;
for(var ib = 0; ib < radomIds.length ; ib++)
{
    var id=  radomIds[ib];
    var  item = items.split('$')[id-1].split('|'); 
    prestr =  item[0] +",";
   //暂存标识
   var isTmp = item[10];
 //下载标识
        var isDownload = item[9];
  //行业
        var strWorkIndustry1 = item[8];
  //职能
        var strWorkFun1 = item[7];
        var strSex = (item[1].indexOf("先生") != -1 || item[1].indexOf("Mr") != -1) ? "0" : "1";
        var  strErrorPic = strSex == "1" ? ImagePath + "woman.png" : ImagePath + "man.png";
        var onerrorHtml = "onerror=\"javascript:this.src='" + strErrorPic + "'\""; //ResumeView.aspx?hiduserid=" + item[0] + "&hidevents=23&hidkey=" + item[12] + "&recommend=1&pageCode=7&Onew=" + item[13] + "
        var links = "ResumeView.aspx?hiduserid=" + item[0] + "&hidevents=23&hidkey=" + item[12] + "&recommend=1&pageCode=7&Onew=" + item[13] ;
        recomhtml += "<!--list--><div id=\"divRom_" + item[0] + "\" class=\"ev-list-detailed ev-list-detailed-two ev-height116\">";//<a href=\"" + links+ "\" target=\"_blank\" class=\"ev-linkToWeb009\"></a>
        recomhtml +="<div class=\"ev-list-pic\"><img src=\"" + item[11] + "\"  " + onerrorHtml + "  class=\"list_detailed_img\" id=\"_img\"></div>";
        recomhtml +="<h3><a href=\"" + links+ "\" target=\"_blank\"class=\"ev-blue_link\" id=\"_name\">" + item[1] + "</a>";//姓名
    
    //暂存标识
    var langTmpdl = lang == "en" ? "Temporary Resume" : "已暂存";
    var langtmp = lang == "en" ? "Temporary Folder" : "放入暂存夹";
    recomhtml += isTmp == "1" ? "<span id=\"_tmp\"><a href=\"javascript:void(0);\" id=\"_movehr_" + item[0] + "\"  title=\"" + langTmpdl + "\"><i class=\"icon icon-star ev-margin006\"></i></a></span> " : 
    "<span id=\"_tmp\"><a href=\"javascript:void(0);\" id=\"_movehr_" + item[0]  + "\" title=\"" + langtmp + "\" onclick=\"EHRRecommend.MoveTemp(" + item[0]  + ");\"><i class=\"icon icon-star-empty ev-margin006\"></i></a></span> "; //EHRRecommend.MoveToTemp.Move(" + item[0]  + ")
    var langdl = lang=="en" ? "Downloaded Resume" : "已下载";
       //下载标识
    recomhtml +=isDownload == "1" ? "<img id=\"downPic_" + item[0]  + "\" class=\"Common_picidsp\" alt=\"" + langdl +"\" title=\"" +  langdl + "\" src=\"" + ImagePath + "commonnew/02.jpg\" align=\"absmiddle\" />" : ""; //"<i class=\"icon icon_download ev-margin006\"></i>"
    recomhtml +="</span> </h3><p class=\"ev-p019\">";
    recomhtml +=item[2] == "" ? "" : "<span class=\"ev-span-limit001\" title=\"" + item[2] +"\">" + item[2] +"</span>";
    recomhtml += item[3]==""? "" : "<span class=\"fgx\">|</span><span>" + item[3] +"</span>";
    recomhtml += item[4]==""? "" : "<span class=\"fgx\">|</span><span  class=\"ev-span-limit002\" title=\"" + item[4] +"\">" + item[4] +"</span>"; 
    recomhtml += item[5]==""? "" : "<span class=\"fgx\">|</span><span class=\"ev-span-limit003\" title=\"" + item[5] +"\" >" + item[5] +"</span>" ;
    recomhtml += item[6]==""? "" : "<span class=\"fgx\">|</span><span class=\"ev-span-limit004\"  title=\"" + item[6] +"\">"+ item[6]+"</span>";
    var sworkfun = lang=="en" ? "Job Function" : "职能";
    recomhtml +="</p><p class=\"ev-margin049\"><span class=\"width-limit width-limit00\" title=\"" + strWorkFun1 +"\" id=\"_wf\">" + sworkfun + "：" + strWorkFun1 +"</span>";//"职能：招聘专员/助理"
     var sworkind = lang=="en" ? "Industry" : "行业";
    recomhtml +="<span class=\"width-limit width-limit00\" title=\"" + strWorkIndustry1+"\" id=\"_wi\">" + sworkind + "：" + strWorkIndustry1 +"</span></p>";//"行业：银行"
    recomhtml += "<p class=\"ev-absoulte019\"><a href=\"javascript:void(0);\" ";
    recomhtml += isDownload == "1" || downitems < 1 ? "class=\"btn-border-gray\"" : " class=\"btn-border-blue\"";
    var sdowncv= lang=="en" ? "Buy Resume" : "下载简历";
    recomhtml +=  isDownload == "1" || downitems < 1 ? ">" + sdowncv  : "onclick=\"EHRRecommend.DownLoad.Move("+ item[0] +");\" id=\"_download"+item[0]+"\">" + sdowncv;//"下载简历"   
    var langview = lang == "en" ? "Display" : "查看简历";  
    recomhtml += "</a><a href=\"" + links+ "\" target=\"_blank\" class=\"btn-border-blue\" id=\"_view_" +  item[0] + "\">" + langview +"</a>";
    recomhtml += "</p></div>";
    recomhtml +="<input type=\"hidden\" id=\"_tmp_" + item[0]  + "\" value=\"" + isTmp+"\"/><input type=\"hidden\" id=\"_down_" + item[0]  + "\" value=\"" + isDownload+"\"/>";
    recomhtml +="<input type=\"hidden\" id=\"_type_" + item[0]  + "\" value=\"" + item[13]  + "\"/><input type=\"hidden\" id=\"_recom_" + item[0]  + "\" value=\"" + item[0]  + "\"/><!--list end-->";
}
 recomhtml +="</div></div>";
 recomhtml +="<input type=\"hidden\" id=\"_itemsUnder8\" value=\""+ items +"\"/><input type=\"hidden\" id=\"_filterstr\" value=\""+ prestr.substr(0, prestr.length-1)+"\"/><input type=\"hidden\" id=\"_prestr\" value=\""+ recomIds+"\"/><input type=\"hidden\" id=\"_nomore\" value=\""+ $('#_nomore').val() +"\"</div></div>";
$("#divRecom").remove();
$("[id*='{0}']".format('resumeRecommend')).after(unescape(recomhtml));
$("#divRecom").show();
}
/*推荐简历 - 放入暂存夹 start*/
  EHRRecommend = {};
EHRRecommend.recomid;
EHRRecommend.time =0;//秒;
EHRRecommend.intervals=null;
EHRRecommend.MoveTemp =function(userid){
    movetmp(userid);
   }
  EHRRecommend.MoveToTemp =
  {
      Move: function (userid)
      {
          EHRRecommend.recomid = userid;
          var postData = {
              userid: userid + '#'+$('#_type_'+ userid).val(),
              doType: "SearchToCompanyTmpHr"
          };
          EHR.Common_AsyncHandle("POST", "xml", "Resume/GlobalDownload.aspx", postData, this.SucHandler, 0);
      },
      SucHandler: function (result)
      {
          var returninfo = $(result).find("returninfo").eq(0).text();
          var msgtype = $(result).find("msgtype").eq(0).text();
          var top = $('#divRecom').height() / 2;
          var left = $('#divRecom').width() / 2 - 10;
          if (msgtype == "1")
          {
              $('#mess').html(returninfo);
              var langTmpdl = lang == "en" ? "Temporary Resume" : "已暂存";
              $('#_movehr_' + EHRRecommend.recomid).attr('title', langTmpdl);
              $('#_movehr_' + EHRRecommend.recomid).find('i').attr('class', 'icon icon-star  ev-margin006');
              $("#mess").css('display', '');
              $('#mess').css({ 'top': top + 'px', 'left': left + 'px' }).stop(true, true).fadeIn("slow").delay(1000).fadeOut(1000, "linear");
              $('#_movehr_' + EHRRecommend.recomid).removeAttr('href');
              $('#_movehr_' + EHRRecommend.recomid).removeAttr('onclick');
              $('#_tmp_'+EHRRecommend.recomid).val('1');
              EHRRecommend.Writeback(10,EHRRecommend.recomid);
          }
           else
          {
              $('#mess').html(returninfo);
          }
          EHRRecommend.time =0;
          EHRRecommend.intervals=null;
          EHR.Common_AsyncAddLog("7", "23", '1' + str_char22 + page_code);//记录日志
      }
  }
 /*推荐简历 - 放入暂存夹 end*/
 /* 推荐简历 - 下载简历 start*/
EHRRecommend.DownLoad = {

    Move: function (userid)
    {
        EHRRecommend.recomid = userid + '#'+$('#_type_'+ userid).val() ;
        EHR.ShowBox(DownLoadAlert, 350, true, "EHRDownLoad.DoDownLoad();", false, true);
    },
    SucHandler: function (result)
    {
        if (typeof (result) != 'object') return false;
        var msgtype = $(result).find("msgtype").eq(0).text(); //服务器返回状态1为成功11为定制0其他情况为失败
        var returninfo = $(result).find("returninfo").eq(0).text(); //服务器返回的信息
        var top = $('#divRecom').height() / 2;
        var left = $('#divRecom').width() / 2 - 10;
        var returnIds = $(result).find("successids").eq(0).text();   // 成功id
        var extendIds = $(result).find("existids").eq(0).text();   // 已存在id
         if(EHRRecommend.recomid.indexOf('#') > 0 && msgtype != "11")  
        {
            EHRRecommend.recomid =  EHRRecommend.recomid.substr(0,EHRRecommend.recomid.length-3)  ;
        } 
        if (msgtype == "11")    //11为需要定制情况
        {
            $("#invite_customized_content").html(returninfo);
            $("#p_customized_alert").html(invite_SelectNumber);
            EHR.ShowDivBox("#div_invite_customized");
        }
        else if (msgtype == "22")
        {    //22为下载简历在收件箱中（提示+刷新）
            EHR.ShowBox(returninfo, 350, true, 'EHRRecommend.DownLoad.show', false, true);
        }
        else
        {
            if (!$("#div_invite_customized").is(":hidden"))
            {
                EHR.CloseDivBox("#div_invite_customized");
            }
            
            EHR.ShowBox(returninfo, 350, 0, "", true);            
        } 
        if (returnIds == EHRRecommend.recomid || extendIds == EHRRecommend.recomid)  //下载成功
        {

            var langdl = lang == "en" ? "Downloaded Resume" : "已下载";
            $('#_dl' + EHRRecommend.recomid).html(" <img id=\"downPic_" + EHRRecommend.recomid + "\" class=\"Common_picidsp\" alt=\"" + langdl + "\" title=\"" + langdl + "\" src=\"" + ImagePath + "commonnew/02.jpg\" align=\"absmiddle\" />");
            $('#_download' + EHRRecommend.recomid).attr('class', 'btn-border-gray');
            EHRRecommend.Writeback(9,EHRRecommend.recomid);
        }
        EHR.Common_AsyncAddLog("7", "22", '1' + str_char22 + page_code);//记录日志
    },
    show: function ()
    {
        var langdl = lang == "en" ? "Downloaded Resume" : "已下载";
        $('#_dl' + EHRRecommend.recomid).html(" <img id=\"downPic_" + EHRRecommend.recomid + "\" class=\"Common_picidsp\" alt=\"" + langdl + "\" title=\"" + langdl + "\" src=\"" + ImagePath + "commonnew/02.jpg\" align=\"absmiddle\" />");
        $('#_download' + EHRRecommend.recomid).attr('class', 'btn-border-gray');
    }
}
 /*推荐简历 - 下载简历  end */
function  IsRecommend(){
 var evalue =$('#hidupt').val();
 var dat = new Date(evalue.replace(/-/g, "/"));
if (new Date() < dat.setYear(dat.getFullYear() + 3)) {
       return 1;
} 
return 0;
}
EHRRecommend.Writeback = function(index,userid){
var  items =$('#_itemsUnder8').val();
if(items != ""){
var  item = items.split('$'); 
var tmp="";
for(var ia = 0; ia< item.length ; ia++) {
var  arr = item[ia].split('|');
if( arr[0]== userid)
{
 arr[index] = 1;
 tmp += arr.join('|')+"$";
}
else
{
tmp += arr.join('|')+"$";
}
}
$('#_itemsUnder8').val(tmp.substr(0,tmp.length-1));
}
}
 function movetmp (userid) {
            if(EHRRecommend.time <= 0){
                EHRRecommend.time=2;
            EHRRecommend.MoveToTemp.Move(userid); 
            EHRRecommend.intervals=setInterval(func,EHRRecommend.time*1000);
            }else {
                return;
            }          
}
function func () {
            if (EHRRecommend.time<=0) {
                clearInterval(EHRRecommend.intervals);
            }else {
                EHRRecommend.time=EHRRecommend.time-1;
            }
        }